import { defineConfig } from 'wxt'
import UnoCSS from 'unocss/vite'

// See https://wxt.dev/api/config.html
export default defineConfig({
    manifest: {
        permissions: ['storage', 'unlimitedStorage', 'tabs', 'cookies'],
        icons: {
            16: '/icon/16.png',
            32: '/icon/32.png',
            48: '/icon/48.png',
            96: '/icon/96.png',
            128: '/icon/128.png',
        },
        web_accessible_resources: [
            {
                resources: ['overrideFetch.js'],
                matches: ['<all_urls>'],
            },
        ],
        content_security_policy: {
            extension_pages:
                "script-src 'self' 'wasm-unsafe-eval'; object-src 'self'",
        },
    },
    modules: ['@wxt-dev/module-react'],
    webExt: {
        startUrls: [
            'https://arco.design/react/components/button',
            'https://yapi.changbaops.com/project/144/interface/api/cat_3272',
        ],
        // openConsole: true,
        openDevtools: true,
    },
    vite: () => ({
        plugins: [UnoCSS()],
        resolve: {
            alias: {
                // 用浏览器版 path 替换 Node.js 的 path
                path: 'path-browserify',
            },
        },
    }),
})
